Bonk's Adventure tile and tilemap format Document rev 1.0 ---------------- Tile Compression ---------------- The first byte of the string is the header byte. If header > 00, Low nibble: each bit represents a bit plane. 1 = tile+mask data 0 = no data(write $00 for that bitplane) If a bit is set, then a single byte mask is read from the string. Up to two masks are read per loop (since bitplanes are interleaved in vram). High nibble: each bit corresponds to a bit plane. 1 = if mask bit is 0, then use $00 for that row of 8 pixels. 0 = if mask bit is 0, then use $FF for that row of 8 pixels. If header = 00, $00 is written for all pixels of that tile. No tile data proceeds the header byte for current tile. Basically this writes a blank tile to vram. An example string of an compressed tile: FF,FE,FE,FE,FE,<7 bytes>,<7 bytes>,<7 bytes>,<7 bytes> The header signifies that there are 4 masks and a run length of zero will be used for all bit planes. $FE = 7 bytes of tile data and a run length of zero on the last row(8) for that plane. Another example: F7,FE,FE,FE,<7 bytes>,<7 bytes>,<7 bytes> There are only 3 masks and bitplanes of data. The last bitplane is padded to $00. Level 1: $8C9A bank $4B ($56C9A in ROM) Table of block address and length --------------------------------- Contains a 6 byte entry. Format: (byte) bank #, (word) logical address, (word) VRAM address, (byte) block length (num of tile entries). If bank # = $FF, then termintate array. Title screen: $CB46, $CB4C, $CB52 Level 1: $CDF5, $CDFB, $CE01 *Routine for decoding table and tiles: $C729(table) and $C77E (tiles)* Tilemap metatile table ---------------------- Level 1 is $8AB3 bank $19 Level 1-2 is @ $4c61 bank $14. table format: 6 bytes long entries first byte: is the tile type/attribute. Used for collision detection,etc. 00=walk through, 01=solid second byte: is the bank of tiles. N * $100 = vram tile number starting position. byte 3-6: are the four tiles used to make the 16x16 metatile. since the value is only $00-FF, the value is added to the bank select byte. All four tiles must be from the same bank/group. Palette association is fixed per bank. One 16 color palette for each bank. There is a total of 3 banks; 1 through 3. All other values will point to garbage in vram (tilemap or sprites). Tilemap ------- level 1 is $8dd4 bank $19. tilemap format: 1 byte = 16x16 metatile The map layout is stored as columns instead of rows. $8DD4-$8DE3 is the first column of metatiles from top to bottom for level 1. Screens are stored sequentially in 20x16 metatiles maps. Note: The beginning of the tilemap is a string of 5 bytes. I'm not sure what they are, but for level one they are all 00's. Each time a column is read, these 5 bytes are read first, then routine jumps to the column address. I think these values might be used as buffer or border, since the values 00 are run through the same metatile converion process. Please contact: tomaitheous@pcedev.net for questions.